let questionsApp = new Vue({
    el:'#questionsApp',
    data:{
        myQuestions:[

        ],
        pageInfo:null,

    },
    methods:{
        loadQuestions:function (page) {
            if(!page || page<1){
                page = 1;
            }
            $.ajax({
                url:'/api/v1/questions/my',
                data:'page='+ page,
                type:'get',
                dataType:'json',
                success:function (json) {
                    let data = json.data;
                    let questions = [];
                    let statusTexts = ['未回复','未解决','已解决'];
                    let statusClasses = ['badge badge-pill badge-warning','badge badge-pill badge-info','badge badge-pill badge-success'];
                    for (let i = 0; i < json.data.list.length; i++) {
                        questions[i] = json.data.list[i];
                        questions[i].statusText = statusTexts[questions[i].status];
                        questions[i].statusClass = statusClasses[questions[i].status];
                        questions[i].tagImage='/img/tags/'+questions[i].tags[0].id+'.jpg';

                        questions[i].createdTimeText = getCreatedTimeText(questions[i].createdTime);

                    }
                    questionsApp.myQuestions = questions;
                    questionsApp.pageInfo=data;
                }
            })
        }
    },
    created:function () {
        this.loadQuestions();
    }

});